package com.lobov.run.hadoop;

import java.io.IOException;
import java.util.StringTokenizer;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

public class WordMapper extends Mapper<LongWritable, Text, Text, Text> {
	
	private Text word = new Text();
	
	public void map(LongWritable key, Text value, Context context) throws IOException,
			InterruptedException {
		StringTokenizer itr = new StringTokenizer(value.toString(), ",");
		while (itr.hasMoreTokens()) {
			word.set(itr.nextToken());
			context.write(new Text(key.toString()), word);
		}
	}

}
